﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.Models;
using PBOffice.BLL;


public partial class custom_News : System.Web.UI.UserControl
{
    List<News> list = new NewsManager().GetAllNewsByType("");
    protected void Page_Load(object sender, EventArgs e)
    {
        List<News> three = new List<News>();
        if (list.Count <= 3)
        {
            this.DataList1.DataSource = list;
            this.DataList1.DataBind();
        }
        else
        {
            for (int i = 0; i < 2; i++)
            {
                three[i] = list[i];
            } 
            this.DataList1.DataSource = three;
            this.DataList1.DataBind();
        }


    }
}